package com.sunchen.asc.service.parameter.repository;

import com.sunchen.asc.service.parameter.domain.ParamType;
import com.sunchen.asc.service.parameter.vo.ParamTypeVo;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface ParamTypeRepository extends JpaRepository<ParamType,Long> {

    Long countByNameAndDeleteFlag(String name,int deleteFlag);

    Long countByValueAndDeleteFlag(String value,int deleteFlag);

    @Query("select new com.sunchen.asc.service.parameter.vo.ParamTypeVo(t.id,t.name,t.value,t.status,t.parentId,t.fixed) from ParamType t where t.name like ?1 and t.deleteFlag = 0")
    List<ParamTypeVo> findVoByName(String name);

    Long countByDeleteFlagAndStatusAndParentId(int deleteFlag,int status,Long parentId);
}
